'''骗一点点分'''
class Solution:
    ans = 1234567890
    def f(self, i, x, save, count, nums: list):
        if save % nums[i] == 0:
            at = count + save // nums[i]
            self.ans = min(at, self.ans)
            return True
        else:
            x_max = save // nums[i+1]
            for x_ in range(x_max, -1, -1):
                r = self.f(i+1, x_, save-x_*nums[i+1], count+x_, nums)
                if r:
                    return True
        return False
    def method(self, p, nums: list):
        for i in range(len(nums)):
            nums[i] %= p
        nums.sort(reverse=True)
        if 0 in nums: return 1  # 已经有整倍的

        x_max = p // nums[0]
        for x in range(x_max, -1, -1):
            r = self.f(0, x, p-x*nums[0], x, nums)
            if r:
                return self.ans
        return 0

     
if __name__ == '__main__':
    n, p = [int(x) for x in input().split()]
    nums = [int(x) for x in input().split()]
    S = Solution()
    ans = S.method(p, nums)
    print(ans)
